﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSConsoleTest
{
    class TestCallByRef : BaseConsoleTest
    {
        public void printDescription()
        {
            Console.WriteLine("--- Call by reference ---");
        }

        public void doTest()
        {
            int value1 = 10;
            int value2 = 20;

            Console.WriteLine("Before swap : value1 = {0}, value2 = {1}", value1, value2);
            swapValue(ref value1, ref value2);
            Console.WriteLine("After swap : value1 = {0}, value2 = {1}", value1, value2);
        }

        private void swapValue(ref int aArg1, ref int aArg2)
        {
            int temp = aArg1;
            aArg1 = aArg2;
            aArg2 = temp;
        }
    }
}
